package com.example.travelhelper.service.serviceImpl;

import com.example.travelhelper.mapper.AdminMapper;
import com.example.travelhelper.pojo.Admin;
import com.example.travelhelper.service.AdminService;

import com.example.travelhelper.utils.Md5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;



@Service
public class AdminServiceImpl implements AdminService {

   @Autowired
    private AdminMapper adminMapper;

    /**
     * 登录数据校验
     * */
    @Override
    public Admin login(String aName, String aPassword){
        Admin admin = adminMapper.selectByName(aName);
        System.out.println(admin);
        if (admin == null) {
            return null;
        } else {
            if ((admin.getAPassword()).equals(Md5Util.getMD5(aPassword))) {

                return admin;
            }
        }
        return null;
    }




}
